<!DOCTYPE html>
<html lang="en" xmlns:v-on="http://www.w3.org/1999/xhtml"
      xmlns:v-bind="http://www.w3.org/1999/xhtml">
<head>
    <meta charset="UTF-8">
    <title>上传附件</title>
    <meta http-equiv="pragma" content="no-cache">
    <meta http-equiv="Cache-Control" content="no-store, must-revalidate">
    <meta http-equiv="expires" content="Wed, 26 Feb 1997 08:21:57 GMT">
    <meta http-equiv="expires" content="-1">
    <meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no"
          name="viewport">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <link rel="shortcut icon" href="/dist/img/icon.png" type="image/x-icon">
    <!-- Bootstrap 3.3.6 -->
    <link rel="stylesheet" href="/dist/plugins/bootstrap/css/bootstrap.min.css">
    <!--字体-->
    <link rel="stylesheet" href="/dist/css/font-awesome.min.css">
    <!--图标-->
    <link rel="stylesheet" href="/dist/css/ionicons.min.css">
    <!--插件样式-->
    <link href="/dist/plugins/ztree/css/zTreeStyle/zTreeStyle.css" rel="stylesheet"/>
    <link rel="stylesheet" href="/dist/plugins/webuploader-0.1.5/webuploader.css">
    <!--OA主样式-->
    <link rel="stylesheet" href="/dist/css/OA.min.css?t=f5a12a1d">
    <link rel="stylesheet" href="/dist/css/skins/OA-skins.min.css?t=16f1e6f3">
    <style type="text/css">
        .user {
            height: 30px;
            line-height: 30px;
            max-height: 30px;
            float: left;
            text-align: left;
            min-width: 32px;
            padding-left: 1px;
            overflow: hidden;
            cursor: pointer;
        }

        td.td-title, td select, td .filename, td.td-module {
            color: black;
            height: 39px;
        }

        .table-detail-payee:nth-child(even) td.td-title {
            background-color: white;
            height: 39px;
        }

        .user:hover {
            background-color: #cfd4d1;
        }

        .userbox .select.user {
            color: #fff;
            background-color: #045B9E;
        }

        .span-btn {
            position: absolute;
            left: 10px;
            margin-top: 4px;
            cursor: pointer;
        }

        .auditorName {
            text-align: center;
        }

        .IcoNormal {
            float: left;
            border-bottom: 0px;
            border-left: 0px;
            background-color: transparent;
            width: 16px;
            height: 16px;
            /*vertical-align: middle;*/
            border-top: 0px;
            border-right: 0px;
            background-image: url(/dist/img/upload_normal.gif);
            background-repeat: no-repeat;
            float: left;
        }

        .progressobj {
            height: 20px;
        }

        .progressobj .delfile {
            float: left;
            margin-left: 10px;
        }

        .select {
            color: #fff;
            background-color: #045B9E;
        }

        td .sp-value {
            display: inline-block;
            padding-left: 6px;
            word-wrap: break-word;
        }

        td {
            color: #2a8cec;
        }

        td.td-title, td select, td .filename, td.td-module {
            color: #333;
            font-weight: normal !important;
            width: 255px;
            height: 39px !important;
        }

        .table-detail-payee:nth-child(even) td.td-title {
            background-color: white;
            height: 39px !important;
        }

        .printDiv {
            display: none;
        }

        .webuploader-pick {
            background: url(/dist/img/fjT1.png) no-repeat 5px center;
            display: block;
            padding: 0 4px;
            height: 22px;
            line-height: 22px;
            padding-left: 15px;
            margin: 0 auto;
            width: 70px;
            border-radius: 4px;
        }

        .webuploader-pick-hover {
            color: #fff !important;
            background: url(/dist/img/fjT2.png) no-repeat 5px center;
            background-color: #0F6099;

        }

        #divUploadedFiles {
            /*padding: 4px;*/
            padding-bottom: 0;
        }

        .biTian {
            position: absolute;
            color: red;
            margin-left: 0px;
            margin-top: 2px;
        }

        .th-title {
            text-align: left !important;
        }
    </style>
</head>
<body>
<iframe id="ifAttach" style="display:none"></iframe>

<section class="content" id="app">
    <div class="oaLoad">
        <div class="loadGif" id="areaProgress"></div>
    </div>
    <table class="table table-bordered text-center" style="table-layout: auto;">
        <tr>
            <td class="td-title" colspan="3">附件名</td>
        </tr>
        <tr>
            <td class="td-title th-title" style="width: 250px;"><i class="biTian">*</i>&nbsp;&nbsp;&nbsp;&nbsp;签字版销售合同原件扫描件
            </td>
            <td class="td-row2 td-value1">
                <div id="divUploadedFiles">
                    <div class="fj-tanzhongStyle " v-for="(attach,i) in contract.attaches1"
                         v-if="attach.name!=''">
                        <b :class="fjStyle(attach.name)"></b>
                        <div class="name" v-if="attach.name" :title="attach.name"
                             v-on:click="download(attach.url,attach.name)">{{attach.name}}
                        </div>
                        <div class="down"><a href="javascript:void(0)" class="nui-txt-link"
                                             v-on:click="download(attach.url,attach.name)">下载</a></div>
                    </div>
                </div>
            </td>
            </td>
            <td style="width: 50px">
                <div class="rightBorder fj fujian Hfj"
                     id="signature">上传附件
                </div>
            </td>
        </tr>
        <!--个人-->
        <template v-if="matchesCard=='true'">
            <template class="td-title" v-if="buyType=='融资租赁打包'||buyType=='内部分期'||buyType=='融资租赁'">
                <template class="td-title" v-if="buyType=='融资租赁打包'||buyType=='融资租赁'">
                    <tr>
                        <td class="td-title th-title" style="width: 250px;"><i class="biTian">*</i>&nbsp;&nbsp;&nbsp;&nbsp;签字版融资合同原件扫描件
                        </td>
                        <td class="td-row2 td-value1">
                            <div id="divUploadedFiles1">
                                <div class="fj-tanzhongStyle " v-for="(attach,i) in contract.attaches6"
                                     v-if="attach.name!=''">
                                    <b :class="fjStyle(attach.name)"></b>
                                    <div class="name" v-if="attach.name" :title="attach.name"
                                         v-on:click="download(attach.url,attach.name)">{{attach.name}}
                                    </div>
                                    <div class="down"><a href="javascript:void(0)" class="nui-txt-link"
                                                         v-on:click="download(attach.url,attach.name)">下载</a></div>
                                </div>
                            </div>
                        </td>
                        </td>
                        <td style="width: 50px">
                            <div class="rightBorder fj fujian Hfj"
                                 id="signatureRZ">上传附件
                            </div>
                        </td>
                    </tr>
                </template>
                <tr>
                    <td class="td-title th-title" style="width: 250px;"><i class="biTian">*</i>&nbsp;&nbsp;&nbsp;&nbsp;客户身份证正反面复印件
                    </td>
                    <td class="td-row2 td-value1">
                        <div id="divUploadedFiles1">
                            <div class="fj-tanzhongStyle " v-for="(attach,i) in contract.attaches2"
                                 v-if="attach.name!=''">
                                <b :class="fjStyle(attach.name)"></b>
                                <div class="name" v-if="attach.name" :title="attach.name"
                                     v-on:click="download(attach.url,attach.name)">{{attach.name}}
                                </div>
                                <div class="down"><a href="javascript:void(0)" class="nui-txt-link"
                                                     v-on:click="download(attach.url,attach.name)">下载</a></div>
                            </div>
                        </div>
                    </td>
                    </td>
                    <td style="width: 50px">
                        <div class="rightBorder fj fujian Hfj"
                             id="customerCcard">上传附件
                        </div>
                    </td>
                </tr>
                <tr>
                    <td class="td-title th-title" style="width: 250px;"><i class="biTian">*</i>&nbsp;&nbsp;&nbsp;&nbsp;户口本首页及本人页复印件
                    </td>
                    <td>
                        <div class="fj-tanzhongStyle" v-for="(attach,i) in contract.attaches3" v-if="attach.name!=''">
                            <b :class="fjStyle(attach.name)"></b>
                            <div class="name" :title="attach.name"
                                 :title="attach.name">{{attach.name}}
                            </div>
                            <div class="down"><a href="javascript:void(0)" class="nui-txt-link"
                                                 v-on:click="download(attach.url,attach.name)">下载</a>
                            </div>
                        </div>
                    </td>
                    <td style="width: 50px">
                        <div class="rightBorder fj fujian Hfj"
                             id="accountBook">上传附件
                        </div>
                    </td>
                </tr>


            </template>

            <template class="td-title" v-if="buyType=='全款'">

                <tr>
                    <td class="td-title th-title" style="width: 250px;"><i class="biTian">*</i>&nbsp;&nbsp;&nbsp;&nbsp;客户身份证正反面复印件
                    </td>
                    <td>
                        <div class="fj-tanzhongStyle" v-for="(attach,i) in contract.attaches2" v-if="attach.name!=''">
                            <b :class="fjStyle(attach.name)"></b>
                            <div class="name" :title="attach.name"
                                 :title="attach.name">{{attach.name}}
                            </div>
                            <div class="down"><a href="javascript:void(0)" class="nui-txt-link"
                                                 v-on:click="download(attach.url,attach.name)">下载</a>
                            </div>
                        </div>
                    </td>
                    <td style="width: 50px">
                        <div class="rightBorder fj fujian Hfj"
                             id="customerCcard">上传附件
                        </div>
                    </td>
                </tr>
            </template>

        </template>
        <!--企业-->
        <template v-else>
            <template class="td-title" v-if="buyType=='融资租赁打包'||buyType=='内部分期'||buyType=='融资租赁'">
                <template class="td-title" v-if="buyType=='融资租赁打包'||buyType=='融资租赁'">
                    <tr>
                        <td class="td-title th-title" style="width: 250px;"><i class="biTian">*</i>&nbsp;&nbsp;&nbsp;&nbsp;签字版融资合同原件扫描件
                        </td>
                        <td class="td-row2 td-value1">
                            <div id="divUploadedFiles1">
                                <div class="fj-tanzhongStyle " v-for="(attach,i) in contract.attaches6"
                                     v-if="attach.name!=''">
                                    <b :class="fjStyle(attach.name)"></b>
                                    <div class="name" v-if="attach.name" :title="attach.name"
                                         v-on:click="download(attach.url,attach.name)">{{attach.name}}
                                    </div>
                                    <div class="down"><a href="javascript:void(0)" class="nui-txt-link"
                                                         v-on:click="download(attach.url,attach.name)">下载</a></div>
                                </div>
                            </div>
                        </td>
                        </td>
                        <td style="width: 50px">
                            <div class="rightBorder fj fujian Hfj"
                                 id="signatureRZ">上传附件
                            </div>
                        </td>
                    </tr>
                </template>
                <tr>
                    <td class="td-title th-title" style="width: 250px;"><i class="biTian">*</i>&nbsp;&nbsp;&nbsp;&nbsp;三证合一的营业执照复印件
                    </td>
                    <td>
                        <div class="fj-tanzhongStyle" v-for="(attach,i) in contract.attaches4" v-if="attach.name!=''">
                            <b :class="fjStyle(attach.name)"></b>
                            <div class="name" :title="attach.name"
                                 :title="attach.name">{{attach.name}}
                            </div>
                            <div class="down"><a href="javascript:void(0)" class="nui-txt-link"
                                                 v-on:click="download(attach.url,attach.name)">下载</a>
                            </div>
                        </div>
                    </td>
                    <td style="width: 50px">
                        <div class="rightBorder fj fujian Hfj"
                             id="threeCertificates">上传附件
                        </div>
                    </td>
                </tr>

                <tr>
                    <td class="td-title th-title" style="width: 250px;"><i class="biTian">*</i>&nbsp;&nbsp;&nbsp;&nbsp;法人身份证正反面复印件
                    </td>
                    <td>
                        <div class="fj-tanzhongStyle" v-for="(attach,i) in contract.attaches2" v-if="attach.name!=''">
                            <b :class="fjStyle(attach.name)"></b>
                            <div class="name" :title="attach.name"
                                 :title="v.name">{{attach.name}}
                            </div>
                            <div class="down"><a href="javascript:void(0)" class="nui-txt-link"
                                                 v-on:click="download(attach.url,attach.name)">下载</a>
                            </div>
                        </div>
                    </td>
                    <td style="width: 50px">
                        <div class="rightBorder fj fujian Hfj"
                             id="customerCcard">上传附件
                        </div>
                    </td>
                </tr>
                <tr>
                    <td class="td-title th-title" style="width: 250px;"><i class="biTian">*</i>&nbsp;&nbsp;&nbsp;&nbsp;户口本首页及本人页复印件
                    </td>
                    <td>
                        <div class="fj-tanzhongStyle" v-for="(attach,i) in contract.attaches3" v-if="attach.name!=''">
                            <b :class="fjStyle(attach.name)"></b>
                            <div class="name" :title="attach.name"
                                 :title="attach.name">{{attach.name}}
                            </div>
                            <div class="down"><a href="javascript:void(0)" class="nui-txt-link"
                                                 v-on:click="download(attach.url,attach.name)">下载</a>
                            </div>
                        </div>
                    </td>
                    <td style="width: 50px">
                        <div class="rightBorder fj fujian Hfj"
                             id="accountBook">上传附件
                        </div>
                    </td>
                </tr>


            </template>
            <template class="td-title" v-if="buyType=='全款'">
                <tr>
                    <td class="td-title th-title" style="width: 250px;"><i class="biTian">*</i>&nbsp;&nbsp;&nbsp;&nbsp;三证合一的营业执照复印件
                    </td>
                    <td>
                        <div class="fj-tanzhongStyle" v-for="(attach,i) in contract.attaches4" v-if="attach.name!=''">
                            <b :class="fjStyle(attach.name)"></b>
                            <div class="name" :title="attach.name"
                                 :title="attach.name">{{attach.name}}
                            </div>
                            <div class="down"><a href="javascript:void(0)" class="nui-txt-link"
                                                 v-on:click="download(attach.url,attach.name)">下载</a>
                            </div>
                        </div>
                    </td>
                    <td style="width: 50px">
                        <div class="rightBorder fj fujian Hfj"
                             id="threeCertificates">上传附件
                        </div>
                    </td>
                </tr>
            </template>
        </template>
        <tr>
            <td class="td-title th-title" style="width: 250px;"><i class="biTian">*</i>&nbsp;&nbsp;&nbsp;&nbsp;商务条件同意截图
            </td>
            <td>
                <div class="fj-tanzhongStyle" v-for="(attach,i) in contract.attaches7" v-if="attach.name!=''">
                    <b :class="fjStyle(attach.name)"></b>
                    <div class="name" :title="attach.name"
                         :title="attach.name">{{attach.name}}
                    </div>
                    <div class="down"><a href="javascript:void(0)" class="nui-txt-link"
                                         v-on:click="download(attach.url,attach.name)">下载</a>
                    </div>
                </div>
            </td>
            <td style="width: 50px">
                <div class="rightBorder fj fujian Hfj"
                     id="businessCondition">上传附件
                </div>
            </td>
        </tr>
        <tr v-if="buyType=='内部分期'">
            <td class="td-title th-title" style="width: 250px;"><i class="biTian">*</i>&nbsp;&nbsp;&nbsp;&nbsp;保单复印件
            </td>
            <td>
                <div class="fj-tanzhongStyle" v-for="(attach,i) in contract.attaches8" v-if="attach.name!=''">
                    <b :class="fjStyle(attach.name)"></b>
                    <div class="name" :title="attach.name"
                         :title="attach.name">{{attach.name}}
                    </div>
                    <div class="down"><a href="javascript:void(0)" class="nui-txt-link"
                                         v-on:click="download(attach.url,attach.name)">下载</a>
                    </div>
                </div>
            </td>
            <td style="width: 50px">
                <div class="rightBorder fj fujian Hfj"
                     id="copyOfPolicy">上传附件
                </div>
            </td>
        </tr>
        <tr>
            <td class="td-title th-title" style="width: 250px;">&nbsp;&nbsp;&nbsp;&nbsp;其他附件</td>
            <td>
                <div class="fj-tanzhongStyle" v-for="(attach,i) in contract.attaches5" v-if="attach.name!=''">
                    <b :class="fjStyle(attach.name)"></b>
                    <div class="name" :title="attach.name"
                         :title="attach.name">{{attach.name}}
                    </div>
                    <div class="down"><a href="javascript:void(0)" class="nui-txt-link"
                                         v-on:click="download(attach.url,attach.name)">下载</a>
                    </div>
                </div>
            </td>
            <td style="width: 50px">
                <div class="rightBorder fj fujian Hfj"
                     id="other">上传附件
                </div>
            </td>
        </tr>
    </table>
    <div class="south no-print" style="height:50px;line-height:50px;text-align:center;">
        <input type="button" style="margin-left:20px;"
               value="保存" class="btn btn-primary btn-sm" @click="save()">
        <!--  <input type="button" style="margin-left:20px;" value="返回上一页" class="btn btn-primary btn-xs"
                       @click="goBack"> -->
    </div>
</section>
<script src="https://file.ggxqce.com/web/jquery-2.2.3.min.js"></script>
<!--插件JS-->
<script src="https://file.ggxqce.com/web/bootstrap.min.js"></script>
<!--框架已定义 JS-->
<script src="/dist/js/app_iframe.js?t=7e54a132"></script>
<!--oa自定义  JS-->
<script src="/dist/js/oa.js?t=63aed32f"></script>

<script src="https://file.ggxqce.com/web/vue.min.js"></script>
<script type="text/javascript" src="/dist/plugins/My97DatePicker/WdatePicker.js"></script>
<!--ztree组件所需js-->
<script type="text/javascript" src="/dist/plugins/ztree/js/jquery.ztree.all-3.5.min.js"></script>
<script type="text/javascript" src="/dist/plugins/ztree/js/jquery.ztree.exhide-3.5.js"></script>
<script src="/dist/plugins/webuploader-0.1.5/webuploader.min.js"></script>
<script type="text/javascript" src="/dist/js/pages/apply/tmpevent/class.js"></script>
<script type="text/javascript" src="/dist/js/pages/system/systemService.js"></script>
<script type="text/javascript" src="/dist/js/pages/common/commonService.js"></script>
<script type="text/javascript" src="/dist/plugins/print/print.js"></script>
<script type="text/javascript" src="/dist/plugins/lhgdialog/lhgdialog.min.js?self=true"></script>
<script type="text/javascript">
    var api = frameElement.api, W = api.opener;

    var app = new Vue({
            el: "#app",
            data: {
                currentUser: getCurrentUser(),
                pageType: $.wyui.page.urlParams.pageType,
                buyType: $.wyui.page.urlParams.buyType,
                contractType: $.wyui.page.urlParams.contractType,
                matchesCard: $.wyui.page.urlParams.matchesCard,
                contract: {
                    contractId: $.wyui.page.urlParams.contractId ? $.wyui.page.urlParams.contractId : '',
                    attaches1: [{name: '', url: ''}],
                    attaches2: [{name: '', url: ''}],
                    attaches3: [{name: '', url: ''}],
                    attaches4: [{name: '', url: ''}],
                    attaches5: [{name: '', url: ''}],
                    attaches6: [{name: '', url: ''}],
                    attaches7: [{name: '', url: ''}],
                    attaches8: [{name: '', url: ''}],
                },
                uploader: null,
            },
            methods: {
                print: function () {
                    $("#app").print({
                        globalStyles: false,
                        mediaPrint: false,
                        stylesheet: "/dist/css/page/print.css?t=" + new Date(),
                        noPrintSelector: ".no-print",
                        iframe: true,
                        append: null,
                        prepend: null,
                        manuallyCopyFormValues: true,
                        deferred: $.Deferred()
                    });
                },
                goBack: function () {
                    api.close();
                },
                hide: function () {
                    var that = this;
                    setTimeout(function () {
                        if (that.contract.attaches1) {
                            if (that.contract.attaches1[0].name != null && that.contract.attaches1[0].name != "" && that.contract.attaches1[0].name != undefined) {
                                $("#signature").hide();
                            }
                        }
                        if (that.contract.attaches2) {
                            if (that.contract.attaches2[0].name != null && that.contract.attaches2[0].name != "" && that.contract.attaches2[0].name != undefined) {
                                $("#customerCcard").hide();
                            }
                        }
                        if (that.contract.attaches3) {
                            if (that.contract.attaches3[0].name != null && that.contract.attaches3[0].name != "" && that.contract.attaches3[0].name != undefined) {
                                $("#accountBook").hide();
                            }
                        }
                        if (that.contract.attaches4) {
                            if (that.contract.attaches4[0].name != null && that.contract.attaches4[0].name != "" && that.contract.attaches4[0].name != undefined) {
                                $("#threeCertificates").hide();
                            }
                        }
                        if (that.contract.attaches5) {
                            if (that.contract.attaches5[0].name != null && that.contract.attaches5[0].name != "" && that.contract.attaches5[0].name != undefined) {
                                $("#threeCertificates").hide();
                            }
                        }
                        if (that.contract.attaches6) {
                            if (that.contract.attaches6[0].name != null && that.contract.attaches6[0].name != "" && that.contract.attaches6[0].name != undefined) {
                                $("#threeCertificates").hide();
                            }
                        }
                        if (that.contract.attaches7) {
                            if (that.contract.attaches7[0].name != null && that.contract.attaches7[0].name != "" && that.contract.attaches7[0].name != undefined) {
                                $("#businessCondition").hide();
                            }
                        }
                        if (that.contract.attaches8) {
                            if (that.contract.attaches8[0].name != null && that.contract.attaches8[0].name != "" && that.contract.attaches8[0].name != undefined) {
                                $("#copyOfPolicy").hide();
                            }
                        }

                    })
                },

                init: function () {
                    var that = this
                    setTimeout(function () {
                        $(".fj").each(function () {
                            var demo = $(this);
                            var name = demo.attr("id");//signature
                            var uploader = WebUploader.create({
                                // 选完文件后，是否自动上传。
                                auto: true,
                                // swf文件路径
                                swf: "/statics/plugin/webuploader-0.1.5/Uploader.swf",
                                // 文件接收服务端。
                                server: server.fjIp + "/attach/uploadFile.json",
                                // 选择文件的按钮。可选。
                                // 内部根据当前运行是创建，可能是input元素，也可能是flash.
                                pick: '#' + demo.attr("id"),
                                duplicate: true
                            });
                            // 文件上传过程中创建进度条实时显示。
                            uploader.on('uploadProgress', function (file, percentage) {
                                var $li = $('#' + file.id),
                                    $percent = $li.find('.progress span');
                                // 避免重复创建
                                if (!$percent.length) {
                                    $percent = $('<p class="progress"><span></span></p>')
                                        .appendTo($li)
                                        .find('span');
                                }
                                $percent.css('width', percentage * 100 + '%');
                            });
                            uploader.on("uploadStart", function () {
                                $("#progress").show();
                            });
                            uploader.on("uploadComplete", function () {
                                $("#progress").hide();
                            });
                            // 文件上传成功，给item添加成功class, 用样式标记上传成功。
                            uploader.on('uploadSuccess', function (file, response) {
                                if (name == 'signature') {
                                    that.contract.attaches1.push({
                                        id: response.id,
                                        name: response.name,
                                        url: response.url
                                    });
                                }
                                if (name == 'customerCcard') {
                                    that.contract.attaches2.push({
                                        id: response.id,
                                        name: response.name,
                                        url: response.url
                                    });

                                }
                                if (name == 'accountBook') {
                                    that.contract.attaches3.push({
                                        id: response.id,
                                        name: response.name,
                                        url: response.url
                                    });
                                }
                                if (name == 'threeCertificates') {
                                    that.contract.attaches4.push({
                                        id: response.id,
                                        name: response.name,
                                        url: response.url
                                    });
                                }
                                if (name == 'other') {
                                    that.contract.attaches5.push({
                                        id: response.id,
                                        name: response.name,
                                        url: response.url
                                    });
                                }
                                if (name == 'signatureRZ') {
                                    that.contract.attaches6.push({
                                        id: response.id,
                                        name: response.name,
                                        url: response.url
                                    });
                                }
                                if (name == 'businessCondition') {
                                    that.contract.attaches7.push({
                                        id: response.id,
                                        name: response.name,
                                        url: response.url
                                    });
                                }
                                if (name == 'copyOfPolicy') {
                                    that.contract.attaches8.push({
                                        id: response.id,
                                        name: response.name,
                                        url: response.url
                                    });
                                }
                            });
                            // 文件上传失败，显示上传出错。
                            uploader.on('uploadError', function (file) {
                                alert("上传失败！");
                            });
                        });
                    }, 500);

                },
                showDatePicker: function (e, item) {
                    WdatePicker({
                        onpicked: function (dp) {
                            item.offTime = dp.cal.getNewDateStr();
                            return true;
                        }
                    });
                    $(e.target).blur();
                },
                fjStyle: function (fjName) {
                    if (fjName) {
                        var type = fjName.substring(fjName.lastIndexOf('.') + 1);
                        return 'img fj-' + type
                    }
                    return 'img'
                },
                inputFocus: function (id) {
                    $("#" + id).focus();
                },
                deleteFile: function (i) {
                    this.contract.attaches.splice(i, 1);
                },
                download: function (attachId, fileName) {
                    downloadFile(attachId, fileName)
                    return false;
                },
                save: function () {
                    var that = this;
                    $.wyui.postLoadMethod("/contractMain/uploadFileByContractId.json", trimRN(that.contract), function (data) {
                         var $iframe = top.findIframeByName("合同管理");
                        $iframe[0].contentWindow.app.search();
                        api.close();
                    }, false, true);
                },
            },

            mounted: function () {
                //页面操作状态
                this.pageType = $.wyui.page.urlParams.pageType;
                //上传附件
                var that = this;
                that.init();
                $.wyui.postLoadMethod("/contractMain/getUploadFileByContractId.json", {contractId: that.contract.contractId}, function (data) {
                    that.contract.attaches1 = data.attaches1;
                    that.contract.attaches2 = data.attaches2;
                    that.contract.attaches3 = data.attaches3;
                    that.contract.attaches4 = data.attaches4;
                    that.contract.attaches5 = data.attaches5;
                    that.contract.attaches6 = data.attaches6;
                    that.contract.attaches7 = data.attaches7;
                    that.contract.attaches8 = data.attaches8;
                }, false, true);
                // that.hide();

            }
        })
    ;

</script>
<script>
    $(function () {
        initAutoComplete();
    });

    function initAutoComplete() {
        $(".auditorName,.copier").autoComplete({
            url: server.ip + urlConfig.system.user.getTop10ByNameUser,
            render: function (users, panel) {
                for (var i = 0; i < users.length; i++) {
                    $("<li></li>").data("autoComplete",
                        users[i]).html("<a>" + users[i].name + "&nbsp;&nbsp;&nbsp;" +
                        "(" + "&nbsp;" + users[i].companyName + "-" + users[i].departName + "-" + users[i].roleName + "&nbsp;" + ") " + "</a>")
                        .appendTo(panel);
                }
            },
            selected: function (user) {
                if ($(this).hasClass("auditorName")) {
                    var idx = $(this).attr("idx");
                    app.tmpEvent.auditors[idx].auditorId = user.id;
                    app.tmpEvent.auditors[idx].auditorName = user.roleName + "-" + user.name;
                } else if ($(this).hasClass("copier")) {
                    var userIds = new Array();
                    for (var i = 0; i < app.tmpEvent.auditors.length; i++) {
                        userIds.push(app.tmpEvent.auditors[i].auditorId);
                    }
                    for (var i = 0; i < app.tmpEvent.copiers.length; i++) {
                        userIds.push(app.tmpEvent.copiers[i].copyPersonId);
                    }
                    if ($.inArray(user.id, userIds) == -1) {
                        app.tmpEvent.copiers.push({copyPersonId: user.id, copyPersonName: user.name});
                    } else {
                        alert("审核人、抄送人不能重复输入");
                    }
                    $(this).val("");
                }
                return false;
            },
            height: 210,
            width: 300
        });
    }
</script>
</body>
</html>